package com.app.bimo.commonbusiness.util;

import android.content.Context;
import android.view.Gravity;
import android.widget.Toast;

/**
 * author zaaach on 2016/1/26.
 */
public class ToastUtils {

    /**
     * 显示吐司
     *
     * @param context
     * @param message
     */
    public static void showToast(Context context, String message) {
        Toast toast = Toast.makeText(context.getApplicationContext(), null, Toast.LENGTH_SHORT);
        toast.setText(message);
        toast.setGravity(Gravity.CENTER, 0, 0);
        toast.show();
    }

    /**
     * 显示吐司
     *
     * @param context
     * @param messageResId
     */
    public static void showToast(Context context, int messageResId) {
        Toast.makeText(context.getApplicationContext(), messageResId, Toast.LENGTH_SHORT).show();
    }

    /**
     * 显示吐司
     *
     * @param context
     * @param messageResId
     * @param gravity
     */
    public static void showToast(Context context, int messageResId, int gravity) {
        Toast.makeText(context.getApplicationContext(), messageResId, Toast.LENGTH_SHORT).show();
    }

    /**
     * 显示吐司
     *
     * @param context
     * @param messageResId
     * @param gravity
     */
    public static void showToast(Context context, String messageResId, int gravity) {
        Toast.makeText(context.getApplicationContext(), messageResId, Toast.LENGTH_SHORT).show();
    }
}
